package org.neptune.common.response;

import java.io.Serializable;
import java.util.List;

import com.google.common.collect.Lists;

/**
 * @author lwl
 * @date 2019/11/26 14:05
 */
public class LayuiTableResponse<T> implements Serializable {

	private static final long serialVersionUID = 7126392998345265613L;

	private int code = 0;

	private String msg;

	private long count;

	private List<T> data = Lists.newArrayList();

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}

	public List<T> getData() {
		return data;
	}

	public void setData(List<T> data) {
		this.data = data;
	}

	public LayuiTableResponse() {

	}

	public LayuiTableResponse(int code, String msg, long count, List<T> data) {
		this.code = code;
		this.msg = msg;
		this.count = count;
		this.data = data;
	}

	public static <T> LayuiTableResponse<T> success(String msg, long count, List<T> data) {
		return new LayuiTableResponse(0, msg, count, data);
	}
}
